package de.jmda.gen.java;

import java.io.File;

public abstract class CompilationUnitUtil
{
	public static File buildFile(
			String rootDirectoryName, String packageName, String simpleTypeName)
	{
		if (simpleTypeName == null)
		{
			throw new IllegalArgumentException("'simpleTypeName' must not be null");
		}

		if (rootDirectoryName == null)
		{
			rootDirectoryName = ".";
		}
		
		if (packageName == null)
		{
			packageName = "";
		}

		return
				new File(
						  rootDirectoryName
						+ "/" + packageName.replaceAll("\\.", "/"),
						simpleTypeName + ".java");
	}
}
